home *** CD-ROM | disk | FTP | other *** search
/ PsL Monthly 1993 December / PSL Monthly Shareware CD-ROM (December 1993).iso / prgmming / dos / pascal / curdle.com / CURDLE.PAS < prev    next >
Encoding:
Pascal/Delphi Source File  |  1989-01-10  |  2.8 KB  |  103 lines

  1.  
  2.  
  3. (*      Dated 1-9-89
  4.         Public domain software from John M. Majkrzak, All rights reserved.
  5.                                     1180 Todd Dr.
  6.                                     Arden Hills, MN  55112
  7.                                     CIS# 76617,264
  8.  
  9.         This demonstration is only to show how you might use the cURDL()
  10.         procedure written in assembler.  See the cURDL.INC file for more
  11.         details.
  12. *)
  13.  
  14.     Uses
  15.       CRT;
  16.  
  17.   {$I cURDL.inc}
  18.  
  19.     Var
  20.       ChRept,
  21.       Finished: Boolean;
  22.       PrevCh,
  23.       Ch:       Char;
  24.       cR, cC:   Byte;
  25.  
  26.     Const
  27.       F1U   = #59;
  28.       F10U  = #68;
  29.       luArr = #75;
  30.       ruArr = #77;
  31.       uuArr = #72;
  32.       duArr = #80;
  33.       AltD  = #32;
  34.       AltX  = #45;
  35.       AltR  = #19;
  36.  
  37.       CurSetU: Set of char = [luArr,ruArr,uuArr,duArr];
  38.  
  39.   Procedure xMsg;
  40.     Begin
  41.     write('Press <ALT> + `X'' to exit, <Alt> + `R'' to toggle REPEAT mode.');
  42.   end;
  43.  
  44.   Function ConfirmFini: Boolean;
  45.     Begin
  46.     ConfirmFini:= True;
  47.   end;
  48.  
  49.   Procedure Extended(Var Fini: Boolean); {Process the extended character.}
  50.     Begin
  51.     Ch:= ReadKey; {Get the extended keypress.}
  52.     If cURDL(Ch, cR, cC) then begin   {Here is where cURDL() does its thing}
  53.                                       {If keypress was a cursor key then}
  54.         If ChRept then write(PrevCh); {See NOTE 1}
  55.         GoToXY(cC, cR);               {send the cursor to where user wants}
  56.       end
  57.     else Case ch of
  58.         F1u:   begin {GiveHelp} end;
  59.         AltR:  ChRept:= NOT(ChRept); {See NOTE 1}
  60.         AltX:  Fini:= ConfirmFini;
  61.         F10u:  begin {PresentMenu} end;
  62.     end;
  63.   end;
  64.  
  65.   Procedure PaintScreen;
  66.     Begin
  67.     Finished:= False;
  68.     ChRept:= False;
  69.     PrevCh:= ' ';
  70.     Repeat
  71.       Ch:= ReadKey;
  72.       Case ch of
  73.         #00:      Extended(Finished);
  74.         #27:      Begin  {GiveHelp} end;
  75.         #13:      If Hi(cwMin)+ WhereY <= Hi(cwMax) then WriteLn
  76.                   else write(ch); {Carrage return, NO linefeed}
  77.         ELSE      Begin
  78.                     Write(ch); {Demo does not prevent scroll.}
  79.                     PrevCh:= Ch;
  80.                   end;
  81.       end;
  82.     until Finished;
  83.   end;
  84.  
  85.   BEGIN
  86.     TextAttr:= White + Blue * 16;
  87.     ClrScr;
  88.     xMsg;
  89.     TextColor(Black);
  90.     TextBackground(White);
  91.     Window(10,8,70,16); {or change this to whatever size you want.}
  92.     ClrScr;
  93.     PaintScreen;
  94.   END.
  95.  
  96. Note 1: AltD keypress combination toggles screen drawing Off/On.  When on,
  97.   the last character printed will be printed again each time a cursor key
  98.   is pressed.
  99.  
  100.   Other software from John M. Majkrzak:
  101.     VT52.PAS,   found on Compuserve BPROGA forum library 2. Public Domain
  102.     SDEFSn.ARC, ditto
  103.     POPTnn.EXE  found on Compuserve EDFORUM forum library 2. Shareware.